import http from '@/utils/http'
import type { Message } from '@/model/message';
import type { chaterType } from '@/model/chat';

// 获取历史消息
export const getHistoryMessages = (chatId: string): any => {
    return http.get(`/classes/Messages`,{
        params:{
            where:{
                chatId
            }
        }
    })
}
// 发送消息
export const postsendMessage = (message:Message):any => {
    return http.post('/classes/Messages', message)
}

// 调用大模型接口
export const dbchat = ({message,history}:{message:string,history:any}):any => {
	return uni.request({
		url:'http://1.95.32.77:3000/aichat',
		method:"POST",
		data:{
			message,
			history
		}
	}).then(res=>{
        return res.data
    })
}